This invention relates to a method and apparatus for converting a thermometer code to a Gray code.
A number may be represented by a thermometer code wherein each successive bit of a data word is assigned a progressively larger value, all of the bits having assigned values below or the same as the number being set to a logical true state, and all of the bits having values higher than the number being set to a logical false state. A common application of a thermometer code is in an analog-to-digital (A/D) converter, in which a voltage range is divided into a set of quantum levels and a comparator associated with each quantum level compares an analog input voltage with the voltage quantum reference, generating an output true state if the input voltage is higher than the voltage quantum reference. The outputs of all the comparators thus form the bits of a thermometer code representing the magnitude of the input voltage when arranged in order of the associated reference voltage quantum level magnitudes.
In comparison to most other commonly used codes, a thermometer code does not represent numbers efficiently in terms of the number of bits required. For instance, an 8-bit thermometer code can represent any one of 9 different numbers (including 0) while a typical 8-bit binary code can represent 256 different numbers. Therefore, the thermometer code output of an A/D converter is usually converted by an encoding circuit to a more compact and useful binary code before being transmitted as data to external circuits. Often, the desired binary code is a weighted, non-adjacent binary code.
U.S. Pat. No. 4,733,220 shows that advantages may arise from converting the thermometer code to a weighted, non-adjacent binary code by first converting the thermometer code to a non-weighted adjacent binary code, such as the well known Gray code, and then converting the non-weighted adjacent binary code to the desired weighted, non-adjacent binary code.
In a practical implementation of the circuit shown in U.S. Pat. No. 4,733,220, the thermometer code signals are in differential form and are converted to single-ended Gray code signals, and each single-ended Gray code signal is compared with a reference voltage to generate a differential Gray code signal.
FIG. 1 illustrates an analog-to-Gray converter in accordance with disclosure in U.S. Pat. No. 4,733,220. The converter comprises an analog-to-thermometer code converter 10, having a set of fifteen comparators 14 and a voltage divider network 18. The outputs of the comparators are applied to respective latches 22.sub.1 -22.sub.15, and the outputs of the latches are applied to a thermometer-to-Gray encoder 26. The thermometer-to-Gray encoder has four channels 26.sub.1 -26.sub.4, for the four Gray code bits G1-G4 respectively. The four channels of the thermometer-to-Gray encoder evaluate the following equations: ##EQU1## where numerals with the prefix T represent thermometer code bits, numerals with the prefix G represent Gray code bits, a bar ( ) over a bit reference represents the negated bit reference, an asterisk (*) represents the AND function and a plus (+) represents the OR function. As described in U.S. Pat. No. 4,733,220, using Eq. 1 to calculate the Gray code values provides certain advantages with respect to propagation of metastable thermometer code bits.
FIG. 1 illustrates the thermometer code signals as being in single-ended form, but in a practical implementation of the analog-to-Gray converter shown in FIG. 1 the output signals provided by the comparators 14 are in differential form and consequently the bits T3, T7, T11, etc. are provided explicitly rather than by negating the respective single-ended signals.
FIG. 2 illustrates one of the latches of this practical implementation of the analog-to-Gray converter. The differential output signal provided by one of the comparators is applied to the differential pair 30, 32 and a differential clock signal is applied to the differential pair 36, 38. If the base of the transistor 30 is high when the base of transistor 36 goes high, i.e. the thermometer code is in the logic true state, the current source 40 supplies current from the Vcc rail through the resistor 44 and transistors 30 and 36. The voltage drop across resistor 44 holds emitter follower transistor 48 low, so the base of transistor 58 is low. Current source 40 does not supply current to resistor 46, so emitter follower 50 is high and the base of transistor 56 is high. The emitters of transistors 48 and 50 constitute the output of the latch. If the input signal received from the comparator is logic true, the emitter of transistor 48 is low and the emitter of transistor 50 is high. When the clock signal changes state, current source 40 supplies current through resistor 44 and transistors 56 and 38, so that the condition that existed when the base of transistor 36 was high is latched. Conversely, if the input signal was logic false when the base of transistor 36 went low, the emitters of the transistors 48 and 50 are latched high and low respectively.
The outputs of latches 22.sub.1, 22.sub.3, 22.sub.5, 22.sub.7, 22.sub.9, 22.sub.11, 22.sub.13 and 22.sub.15 are connected to the channel 26.sub.1 of the thermometer-to-Gray encoder 26. The channel 26.sub.1 has four stages, of which two, designated 62 and 64, are shown in FIG. 3. Each stage comprises two differential pairs receiving the outputs of two latches. Thus, the output of the latch 22.sub.1 is connected to the differential pair 66.sub.1 and the output of the latch 22.sub.3 is connected through an appropriate level shifter to the differential pair 66.sub.3. The differential pair 66.sub.1 and 66.sub.3 of the stage 62 provide collector current to a load resistor 72, which is tapped by the emitter follower transistor 76. The transistor 76 supplies a current that varies in accordance with the function T1*T3 to a node 78. The emitter followers of the three other stages supply currents that vary in accordance with the functions T5*T7, T9*T11 and T13*T15 respectively to the node 78, which is connected to ground through a pull-down resistor 80. The connections of the emitter followers to the node 78 accomplish a wire-or function, so that the current supplied to the node 78 develops a voltage across the pull-down resistor 80 representative of the single-ended Gray code signal G1. The voltage at the node 78 and a suitable reference voltage are applied to a differential input latch (not shown) which provides a differential Gray code signal that is then combined with the differential Gray code signals G2-G4 to provide a differential non-weighted adjacent binary code signal.
The thermometer-to-Gray encoder shown in FIG. 3 provides a single-ended output signal and accordingly is subject to the well known disadvantages relative to differential circuitry. For example, crosstalk between the Gray code signals and other signals within the A/D converter due to parasitic capacitances and/or power supply impedances is not canceled as it would be with differential signals. Further for a given noise margin, the single-ended signal swing must be twice that of the corresponding differential signal.